﻿namespace Rail.Commons.SerializeHelper
{
    /// <summary>
    /// 默认xml配置读取
    /// </summary>
    public class DefaultConfigXmlHelper : XmlHelper
    {
        private static string DEFAULT_XML_CONFIG_PATH
        {
            get
            {
                return Paths.ApplicationConfigDir + "/default-config.xml";
            }
        }
        private DefaultConfigXmlHelper(string xmlFile) : base(xmlFile)
        {

        }
        private static DefaultConfigXmlHelper m_Instance;
        public static DefaultConfigXmlHelper Instance
        {
            get
            {
                if (m_Instance == null) m_Instance = new DefaultConfigXmlHelper(DEFAULT_XML_CONFIG_PATH);
                return m_Instance;
            }
        }

        public string WebServerIP()
        {
            return m_Instance.GetNodeContent("Settings/WebServer/Host");
        }
        public string WebServerPort()
        {
            return m_Instance.GetNodeContent("Settings/WebServer/Port");
        }

        public string WebServerHost
        {
            get
            {
                return "http://" + WebServerIP() + ":" + WebServerPort();
            }
        }
    }
}
